.TH tmpfs-config 5 "18 Feb 2012" "" "Debian Administrator's Manual"
.SH NAME
tmpfs-config \- variables that configure tmpfs filesystems mounted during boot
.SH DESCRIPTION
The
.I /etc/default/tmpfs
file contains variable settings in POSIX format:
.IP "" .5i
VAR=VAL
.PP
Only one assignment is allowed per line.
Comments (starting with '#') are also allowed.
.PP
This file is for the configuration of tmpfs filesystems mounted in
early boot, before filesystems from /etc/fstab are mounted.  This
currently includes the filesystems /run, /run/lock, /run/shm and /tmp.
/run is required to be a tmpfs on systems supporting tmpfs mounts.
/run/lock and /run/shm may be separate tmpfs mounts, useful for
enforcing separate size limits.  /tmp is not required to be a tmpfs,
and is not mounted as a tmpfs by default.
.PP

.IP /run
Previously configured using \fBRAMRUN\fP in /etc/default/rcS, /run is
now always mounted as a ram file system (tmpfs).  The size of the
tmpfs can be controlled using TMPFS_SIZE and RUN_SIZE.  If desired,
the defaults may also be overridden with an entry in in /etc/fstab,
for example:

.EX
tmpfs	/run	tmpfs	nodev,nosuid,size=10%,mode=755	0	0
.EE

.IP
The contents of /run will always be lost on system reboot, and it it
is no longer explicitly cleaned at boot.  Packages can not expect
directories in /run to exist after boot.  Packages expecting this are
buggy and need to be fixed.  Note that /run was previously /var/run,
and a compatibility symlink or bind mount will be created to allow the
old path to continue to function.

.IP /run/lock
Previously configured using \fBRAMLOCK\fP in /etc/default/rcS.
Configured using RAMLOCK, TMPFS_SIZE and LOCK_SIZE.  If desired,
the defaults may also be overridden with an entry in in /etc/fstab,
for example:

.EX
tmpfs	/run/lock	tmpfs	nodev,noexec,nosuid,size=52428800,mode=1777	0	0
.EE

.IP
Note that irrespective of these settings, /run/lock will be located on
a tmpfs, either one mounted on /run/lock (if RAMLOCK=yes) or one
mounted on /run (if RAMLOCK=no), and as a result the contents of
/var/lock will always be lost on system reboot, and it it is no longer
explicitly cleaned at boot.  Packages can not expect directories in
/var/lock to exist after boot.  Packages expecting this are buggy and
need to be fixed.  Note that /run/lock was previously /var/lock, and a
compatibility symlink or bind mount will be created to allow the old
path to continue to function.

.IP /run/shm
Previously configured using \fBRAMSHM\fP in /etc/default/rcS.  Note
that the setting in /etc/default/rcS, if present, will still be used,
but the setting in /etc/default/tmpfs will take precedence if enabled.
Configured using RAMSHM, TMPFS_SIZE and SHM_SIZE.  If desired, the
defaults may also be overridden with an entry in in /etc/fstab, for
example:

.EX
tmpfs	/run/shm	tmpfs	nosuid,nodev,size=40%,mode=1777	0	0
.EE

.IP
Packages can not expect directories in /run/shm to exist after boot.
Note that /run/shm was previously /dev/shm, and a compatibility
symlink or bind mount will be created to allow the old path to
continue to function.  If an fstab entry for /dev/shm exists instead
of /run/shm, then /dev/shm will continue to be used; note that this is
only needed for users of newer versions of the Oracle database, which
contain a buggy check for /dev/shm.

.IP /tmp
Previously configured using \fBRAMTMP\fP in /etc/default/rcS.  Note
that the setting in /etc/default/rcS, if present, will still be used,
but the setting in /etc/default/tmpfs will take precedence if enabled.
Configured using RAMTMP, TMPFS_SIZE and TMP_SIZE.  If desired, the
defaults may also be overridden with an entry in in /etc/fstab, for
example:

.EX
tmpfs	/tmp	tmpfs	nodev,nosuid,size=20%,mode=1777	0	0
.EE

.IP
Packages can not expect directories in /tmp to exist after boot.

.PP
\fBNOTE: This file is ignored when systemd is used as init system.\fP

.SH OPTIONS
The following variables can be set.

.SS Enabling or disabling tmpfs mounts

.PP
The following options enable specific mounts (with the exception of
/run) to be enabled or disabled.  Note that the addition of an entry
to /etc/fstab for any of the following will enable the mount
unconditionally, overriding the setting here.

.IP \fBRAMLOCK\fP
Mount /run/lock as a tmpfs (separately from /run).  Defaults to
\fByes\fP; set to \fBno\fP to disable (/run/lock will then be part of
the /run tmpfs, if available).

.IP \fBRAMSHM\fP
Mount /run/shm as a tmpfs (separately from /run).  Defaults to
\fByes\fP; set to \fBno\fP to disable (/run/shm will then be part of
the /run tmpfs, if available).

.IP \fBRAMTMP\fP
Mount /tmp as a tmpfs.  Defaults to \fBno\fP; set to \fByes\fP to
enable (/tmp will be part of the root filesystem if disabled).  /tmp
may also be configured to be a separate mount in /etc/fstab, which
will override the RAMTMP setting.

.SS Configuring size limits for tmpfs mounts

.PP
The following options configure size limits for tmpfs mounts.  Note
that the addition of an entry to /etc/fstab will override any of the
limits specified here.
.PP
The following _SIZE variables are the maximum size (in bytes) that
tmpfs filesystems can use.  The size will be rounded down to a
multiple of the page size, 4096 bytes.  If no size is set, TMPFS_SIZE
will be used as the default.
.PP
More complex mount options may be used by the creation of a
suitable entry in /etc/fstab.  For example:

.EX
tmpfs	/run	tmpfs	size=10%	0	0
.EE

is equivalent to

.EX
RUN_SIZE=10%
.EE

and will override the RUN_SIZE setting.  This will allow additional
options such as nr_blocks and nr_inodes to be used, and also
adjustment of the mode, nodev, nosuid, noexec options should any
change from the defaults be necessary.

.IP "\fBTMPFS_SIZE\fP"
Maximum size for all tmpfs filesystems if no specific size is
provided.  The default is \fB20%VM\fP (20% of virtual memory,
including swap space).  If no value is provided here, the kernel
default (50% RAM) will be used.  Note that the "%VM" suffix may be
used in this and all the _SIZE settings below, but may not be used in
/etc/fstab (the absolute size is calculated by the init scripts).

.IP "\fBRUN_SIZE\fP"
Maximum size of /run (was previously /var/run).  The default is 10%
core memory; the size required varies widely depending upon the
demands of the software being run; this heuristic scales /run usage on
system size.  Samba in particular has been seen to use at least 50MiB
in a large heavily used server.  Typical usage is hundreds of KiB,
maximum is tens of MiB.

.IP "\fBLOCK_SIZE\fP"
Maximum size of /run/lock (was previously /var/lock).  Defaults to
5242880 (5 MiB).  Typical usage: tens of KiB; maximum hundreds of KiB.
The default of 5 MiB should ensure the limit is never reached.

.IP "\fBSHM_SIZE\fP"
Maximum size of /run/shm (was previously /dev/shm).  No default size;
the size required varies widely depending upon the demands of the
software being run.

.IP "\fBTMP_SIZE\fP"
Maximum size of /tmp.  No default size.

.SS Emergency overflow /tmp

.PP
If the amount of free space on the root filesystem falls below a
certain size, a tmpfs will be mounted on /tmp (irrespective of the
RAMTMP setting, which this overrides).  This is to permit logins when
there would otherwise be too little free space for this to be possible.

.IP "\fBTMP_OVERFLOW_LIMIT\fP"
Mount a tmpfs on /tmp if the amount of free space on the root
filesystem is below the specified limit at boot time (default 1024
KiB).

.SH AUTHOR
Roger Leigh <rleigh@debian.org>

.SH SEE ALSO
.BR rcS (5),
.BR tmpfs (5),
.BR mount (8).
